'use strict'

const Controller = require('egg').Controller;

class StarController extends Controller {

	async add(){
		const ctx = this.ctx;
		console.log(ctx.request);
		
		let data = {
			pid: ctx.params.pid,
			uid: 1,
		};

		let result = ctx.service.star.add(data);

		ctx.body = {
			code: 'SUCCESS',
			msg: '已收藏'
		};
	}

	async delete(){
		const ctx = this.ctx;

		let data = {
			pid: ctx.params.pid,
			uid: 1,
		};

		let result = ctx.service.star.delete(data);
		ctx.body = {
			code: 'SUCCESS',
			msg: '已取消收藏',
		};
	}
}

module.exports = StarController;